import 'package:flutter/material.dart';
import 'package:shopping_group/res/colors.dart';

class IdNameEntity {
  String id;
  String name;
  String imageUrl;
  bool isSelect = false;
  Color color = Colours.yanqi_red;
  Color radiusColor = Colours.transparent;

  String pdType;
  String parentPdId;
  String oneLevelPdId;
  String twoLevelPdId;
  String remark;
  String displaySeq;
  List<IdNameEntity> children = [];
  IdNameEntity(
      {this.id,
      this.name,
      this.children,
      this.pdType,
      this.parentPdId,
      this.oneLevelPdId,
      this.twoLevelPdId,
      this.remark,
      this.displaySeq});

  IdNameEntity.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    pdType = json['pdType'];
    parentPdId = json['parentPdId'];
    oneLevelPdId = json['oneLevelPdId'];
    twoLevelPdId = json['twoLevelPdId'];
    remark = json['remark'];
    displaySeq = json['displaySeq'];
    name = json['name'];
    if (json['children'] != null) {
      children = [];
      json['children'].forEach((v) {
        children.add(new IdNameEntity.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['pdType'] = this.pdType;
    data['parentPdId'] = this.parentPdId;
    data['oneLevelPdId'] = this.oneLevelPdId;
    data['twoLevelPdId'] = this.twoLevelPdId;
    data['remark'] = this.remark;
    data['displaySeq'] = this.displaySeq;
    if (this.children != null) {
      data['children'] = this.children.map((v) => v.toJson()).toList();
    }
    return data;
  }
}
